package com.chenfan.common.core.domain;

import com.chenfan.common.core.entity.BusinessEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author weishili
 * @Description: 聚合内实体
 */
@Deprecated
@Data
@EqualsAndHashCode(callSuper = true)
public abstract class Entity extends BusinessEntity {

    /**
     * 所属公司
     */
    protected Long companyId;

    // 扩展字段
    protected Map<String, Object> extValues = new ConcurrentHashMap<>();

    public <T> T getExtField(String key) {
        if (extValues != null) {
            return (T) extValues.get(key);
        }
        return null;
    }

    public void putExtField(String key, Object value) {
        this.extValues.put(key, value);
    }

}
